// Web Detail
$title="select * from web_detail where id=1";
$titlere=mysqli_query($con_db, $title) or die("ERROR $title บรททัด4");
$titler=mysqli_fetch_assoc($titlere);
$title_socail="select * from web_social where id=1";
$titlere_socail=mysqli_query($con_db, $title_socail) or die("ERROR $title_socail บรททัด 15 Footer");
$titler_socail=mysqli_fetch_assoc($titlere_socail);
// Site Logo
$banner="select * from site_logo where id=1";
$bannerre=mysqli_query($con_db, $banner) or die("ERROR $banner บรททัด10");
$bannerr=mysqli_fetch_assoc($bannerre);
// Background
$bg="select * from bg where id=1";
$bgre=mysqli_query($con_db, $bg) or die("ERROR $bg บรททัด13");
$bgr=mysqli_fetch_assoc($bgre);
// Viewport
$viewport="select * from viewport where id=1";
$viewport_s=mysqli_query($con_db, $viewport) or die("ERROR $viewport บรททัด21");
$viewport_x=mysqli_fetch_assoc($viewport_s);
// Fanpage
$fb="select * from fanpage where id=1";
$fbre=mysqli_query($con_db, $fb) or die("ERROR $fb บรททัด16");
$fbr=mysqli_fetch_assoc($fbre);
// Stats
$st="select * from stats where id=1";
$stre=mysqli_query($con_db, $st) or die("ERROR $st บรททัด19");
$str=mysqli_fetch_assoc($stre);
$topic = $_GET['views'] ?? null;
$spost="SELECT * FROM `post` WHERE id='$topic'";
$repost=mysqli_query($con_db, $spost) or die("ERROR $spost");
$rpost=mysqli_fetch_assoc($repost);
?>
function func($detail)
{
$detail=str_replace(chr(13), "
", $detail);
$detail=str_replace(" ", " ", $detail);
return $detail;
}
function rewrite($url)
{
$url=str_replace(" ", "-", $url);
return $url;
}
function rewrite2($url2)
{
$url2=str_replace("/", "-", $url2);
return $url2;
}
?>
function DateThai($strDate)
{
$strYear = date("Y",strtotime($strDate))+543;
$strMonth= date("n",strtotime($strDate));
$strDay= date("j",strtotime($strDate));
$strMonthCut = Array("","ม.ค.","ก.พ.","มี.ค.","เม.ย.","พ.ค.","มิ.ย.","ก.ค.","ส.ค.","ก.ย.","ต.ค.","พ.ย.","ธ.ค.");
$strMonthThai=$strMonthCut[$strMonth];
return "$strDay $strMonthThai $strYear";
}
/*$dt= "2012-01-17";
$strDate = $dt;
echo "Date Time now : ".DateThai($strDate);*/
?>
class Paginator{
var $items_per_page;
var $items_total;
var $current_page;
var $num_pages;
var $mid_range;
var $low;
var $high;
var $limit;
var $return;
var $default_ipp;
var $querystring;
var $url_next;
var $start_range;
var $range;
var $end_range;
function __construct()
{
$this->current_page = 1;
$this->mid_range = 7;
$this->items_per_page = $this->default_ipp;
$this->url_next = $this->url_next;
}
function paginate()
{
if(!is_numeric($this->items_per_page) OR $this->items_per_page <= 0) $this->items_per_page = $this->default_ipp;
$this->num_pages = ceil($this->items_total/$this->items_per_page);
if($this->current_page < 1 Or !is_numeric($this->current_page)) $this->current_page = 1;
if($this->current_page > $this->num_pages) $this->current_page = $this->num_pages;
$prev_page = $this->current_page-1;
$next_page = $this->current_page+1;
if($this->num_pages > 1)
{
$this->return .= (($this->current_page != 1 And $this->items_total >= 1)) ? "